package com.zhiwang.planet.widget

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.widget.RadioButton
import com.zhiwang.planet.util.dp2px

class MsgRadioButton(context: Context?, attrs: AttributeSet?) : RadioButton(context, attrs) {

    val paint: Paint

    init {
        paint = Paint(Paint.ANTI_ALIAS_FLAG)
        paint.style = Paint.Style.FILL;
        paint.color = Color.RED;

    }

    private var hint = false;

    fun showHint() {
        hint = true
        invalidate()
    }

    fun hideHint(){
        hint = false
        invalidate()
    }

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)

        if (hint) {
            val r = dp2px(context, 3f).toFloat()
            canvas?.drawCircle(r, r, r, paint)
        }
    }
}